package net.chenlin.dp.modules.base.service.impl;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import net.chenlin.dp.common.entity.Page;
import net.chenlin.dp.common.entity.Query;
import net.chenlin.dp.common.entity.R;
import net.chenlin.dp.common.utils.CommonUtils;
import net.chenlin.dp.modules.base.entity.SysPartXiaoshuoEntity;
import net.chenlin.dp.modules.base.manager.SysPartXiaoshuoManager;
import net.chenlin.dp.modules.base.service.SysPartXiaoshuoService;

/**
 * 零件销售
 *
 * @author ZhouChenglin
 * @email yczclcn@163.com
 * @url www.chenlintech.com
 * @date 2018年12月04日 下午9:13:58
 */
@Service("sysPartXiaoshuoService")
public class SysPartXiaoshuoServiceImpl implements SysPartXiaoshuoService {

	@Autowired
	private SysPartXiaoshuoManager sysPartXiaoshuoManager;

	@Override
	public Page<SysPartXiaoshuoEntity> listSysPartXiaoshuo(Map<String, Object> params) {
		Query query = new Query(params);
		Page<SysPartXiaoshuoEntity> page = new Page<>(query);
		sysPartXiaoshuoManager.listSysPartXiaoshuo(page, query);
		return page;
	}

	@Override
	public R saveSysPartXiaoshuo(SysPartXiaoshuoEntity role) {
		int count = sysPartXiaoshuoManager.saveSysPartXiaoshuo(role);
		return CommonUtils.msg(count);
	}

	@Override
	public R getSysPartXiaoshuoById(Long id) {
		SysPartXiaoshuoEntity sysPartXiaoshuo = sysPartXiaoshuoManager.getSysPartXiaoshuoById(id);
		return CommonUtils.msg(sysPartXiaoshuo);
	}

	@Override
	public R updateSysPartXiaoshuo(SysPartXiaoshuoEntity sysPartXiaoshuo) {
		int count = sysPartXiaoshuoManager.updateSysPartXiaoshuo(sysPartXiaoshuo);
		return CommonUtils.msg(count);
	}

	@Override
	public R batchRemove(Long[] id) {
		int count = sysPartXiaoshuoManager.batchRemove(id);
		return CommonUtils.msg(id, count);
	}

}
